Skip to content

feat(bundler-plugins): Delete source maps with deleteSourcemapsAfterUpload: true when no upload runs - #26281

Merged
timfish merged 12 commits into
developfrom
feat/bundler-plugins-delete-without-upload
Nov 13, 2026
Merged

timfish merged 12 commits into
developfrom
feat/bundler-plugins-delete-without-upload

Conversation

@timfish

@timfish timfish commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

deleteSourcemapsAfterUpload: true now removes source maps even when no upload runs, for example without an auth token, org or project. The framework SDKs turn on hidden source maps and delete them with globs that run whether or not an upload happened. Once they move to deleteSourcemapsAfterUpload: true, a build without an auth token would otherwise keep those maps in its output. The plugin still does not turn source maps on when it cannot upload them, and in development mode (NODE_ENV=development) it changes nothing, as before. With sourcemaps.disable set, maps the user enabled stay for a manual upload and the plugin warns, as before. The option is not released yet.

The SDKs also need two internal options, on internal option types only; the public options do not change. First, deleteSourcemapsAfterUpload can be a function that the plugin calls when it decides, because the SDK Vite plugins only know that they turned maps on in their own config hook, after they created this plugin. On Vite it receives the environment name when an environment sets its own build.sourcemap. Second, sdkEnabledSourceMaps tells the plugin that the SDK turned the maps on. The plugin then removes every map of that build, as the SDK globs did: CSS maps, maps of chunks that assets or ignore leave out, maps of outputs with their own sourcemap setting, and maps other plugins emit as assets, such as Vite worker bundles. It also removes them with sourcemaps.disable, after it stamps the debug IDs. Without the flag, the plugin removes all maps only when it turned them on itself.

@timfish
timfish marked this pull request as ready for review November 11, 2026 11:06
@timfish
timfish requested review from a team, JPeer264 and stephanie-anderson November 11, 2026 11:06
@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: fd408c6 (PR test merge using develop at ed74679)

Against: ed74679 (develop) · base run #66013

✅ Baseline matches: this diff contains only this PR's changes.

Path Size % Change Change
@sentry/browser 30.1 kB - -
@sentry/browser - with treeshaking flags 28.3 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 28.2 kB - -
@sentry/browser (incl. Tracing) 52.28 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 52.29 kB - -
@sentry/browser (incl. Tracing, Profiling) 55.25 kB - -
@sentry/browser (incl. Tracing, Replay) 92.82 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 81.6 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 97.21 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 110.6 kB - -
@sentry/browser (incl. Feedback) 47.73 kB - -
@sentry/browser (incl. sendFeedback) 30.69 kB - -
@sentry/browser (incl. FeedbackAsync) 35.69 kB - -
@sentry/browser (incl. Metrics) 31.43 kB - -
@sentry/browser (incl. Logs) 31.71 kB - -
@sentry/browser (incl. Metrics & Logs) 32.37 kB - -
@sentry/react 32.11 kB - -
@sentry/react (incl. Tracing) 54.95 kB - -
@sentry/vue 38.3 kB - -
@sentry/vue (incl. Tracing) 55.24 kB - -
@sentry/svelte 30.12 kB - -
@sentry/remix (Remix 3 client bundle) 58.06 kB - -
CDN Bundle 31.87 kB - -
CDN Bundle (incl. Tracing) 52.7 kB - -
CDN Bundle (incl. Logs, Metrics) 34.67 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 55.26 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 75.7 kB - -
CDN Bundle (incl. Tracing, Replay) 90.72 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 93.33 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 96.09 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 98.69 kB - -
CDN Bundle - uncompressed 92.98 kB - -
CDN Bundle (incl. Tracing) - uncompressed 155.45 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 101.33 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 163.08 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 231.43 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 275.6 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 283.23 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 287.39 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 295.01 kB - -
@sentry/nextjs (client) 58.34 kB - -
@sentry/sveltekit (client) 53.46 kB - -
@sentry/core/server 44.57 kB - -
@sentry/core/browser 13.99 kB - -
@sentry/node 149.54 kB -0.01% -4 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.3 kB - -
@sentry/node - without tracing 88.47 kB -0.01% -7 B 🔽
@sentry/node - without channel injection 138.5 kB -0.01% -2 B 🔽
@sentry/aws-serverless 97.39 kB -0.01% -6 B 🔽
@sentry/cloudflare (withSentry) - minified 204.55 kB - -
@sentry/cloudflare (withSentry) 474.76 kB - -
@sentry/nextjs/cloudflare (withSentry) - minified 229.86 kB - -

View base workflow run

@timfish
timfish requested review from isaacs and removed request for stephanie-anderson November 11, 2026 11:11
@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Optional E2E tests

Some optional checks were not successful. They do not block the merge. 4 not successful, 56 successful. See the run.

Check Status
❌ CI: Optional E2E Tests / E2E nextjs-16-cacheComponents (cloudflare) Test (optional) Failing after 11m Details
❌ CI: Optional E2E Tests / E2E node-eve Test (optional) Failing after 2m Details
❌ CI: Optional E2E Tests / E2E node-eve (orchestrion) Test (optional) Failing after 2m Details
❌ CI: Optional E2E Tests / E2E node-eve (latest) Test (optional) Failing after 2m Details
Successful checks
Check Status
✅ CI: Optional E2E Tests / E2E cloudflare-workers-send-to-sentry Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E cloudflare-pi-durable Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-pi-durable (latest) Test (optional) Successful in 44s Details
✅ CI: Optional E2E Tests / E2E cloudflare-agent Test (optional) Successful in 38s Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries Test (optional) Successful in 57s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext, bun) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-orpc Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries (latest) Test (optional) Successful in 46s Details
✅ CI: Optional E2E Tests / E2E astro-7 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (deno) Test (optional) Successful in 54s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries (cloudflare) Test (optional) Successful in 41s Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (turbo) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E cloudflare-flue-send-to-sentry Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nextjs-16-tunnel (cloudflare) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E astro-7-static Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E debug-id-sourcemaps Test (optional) Successful in 35s Details
✅ CI: Optional E2E Tests / E2E cloudflare-think Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-mastra Test (optional) Successful in 49s Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (cloudflare) Test (optional) Successful in 38s Details
✅ CI: Optional E2E Tests / E2E node-flue (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-fastify-6 (tracer provider) Test (optional) Successful in 35s Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (tunnel-dev) Test (optional) Successful in 47s Details
✅ CI: Optional E2E Tests / E2E cloudflare-think (ai v6) Test (optional) Successful in 55s Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (bun) Test (optional) Successful in 59s Details
✅ CI: Optional E2E Tests / E2E nextjs-14 (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E deno (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v1 Test (optional) Successful in 31s Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (latest) Test (optional) Successful in 48s Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v2 Test (optional) Successful in 37s Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-openai-decisions Test (optional) Successful in 28s Details
✅ CI: Optional E2E Tests / E2E react-router-7-framework-instrumentation Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (cloudflare, latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-mastra (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E vue-3 (no Options API) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (kv-cache) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry-static Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-cloudflare Test (optional) Successful in 42s Details
✅ CI: Optional E2E Tests / E2E node-fastify-6 Test (optional) Successful in 30s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps kept) Test (optional) Successful in 33s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-cloudflare Test (optional) Successful in 29s Details
✅ CI: Optional E2E Tests / E2E node-flue Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-mastra Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-pi-durable Test (optional) Successful in 36s Details
✅ CI: Optional E2E Tests / E2E supabase-nextjs Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-pi-durable (latest) Test (optional) Successful in 34s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (static / nuxt generate) Test (optional) Successful in 34s Details
✅ CI: Optional E2E Tests / E2E react-send-to-sentry Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps Test (optional) Successful in 31s Details
✅ CI: Optional E2E Tests / E2E solidstart-2 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps Test (optional) Successful in 37s Details
✅ CI: Optional E2E Tests / E2E node-openai-decisions (latest) Test (optional) Successful in 28s Details

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

…`deleteSourcemapsAfterUpload`

SDK packages turn on hidden source maps themselves, so the plugin read them as maps the user enabled and removed only the maps of uploaded chunks. Maps of chunks that `sourcemaps.assets` or `sourcemaps.ignore` leave out, and CSS maps, stayed in the build output.

The internal option `sourcemaps.sdkEnabledSourceMaps` (a boolean or a function the plugin calls when it decides) tells the plugin that the SDK turned the maps on. With `deleteSourcemapsAfterUpload: true` the plugin then removes them like maps it turned on itself: all JS and CSS maps of the build, with or without an upload. Webpack, Rollup, Rolldown, Vite and esbuild read it.
@timfish
timfish requested a review from logaretm November 12, 2026 12:32
…e SDK turned source maps on

With `deleteSourcemapsAfterUpload: true` and `sdkEnabledSourceMaps`, the Vite plugin now also removes the maps of an output that sets `sourcemap` itself, visible ones included. The SDKs' old globs removed these maps when `build.sourcemap` was unset, so the SDKs keep that behaviour.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

…keep maps in development

With removeAllSourceMaps, Rollup and Vite now also drop maps that other plugins emit as assets, such as Vite worker bundle maps, but only when the SDK turned the maps on. With an unset setting, the plugin keeps asset maps, as it did before. In development mode the plugin no longer changes or deletes source maps, and esbuild logs again why no upload ran.

@JPeer264 JPeer264 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tbh I like the feature, as it makes it safer that sourcemaps are not leaked by accident. I still added one concern about a potential misconfiguration.

plugins: [
sentryEsbuildPlugin({
telemetry: false,
sourcemaps: { disable: 'disable-upload', deleteSourcemapsAfterUpload: true },

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m: That is a weird combination tbh. In this case I actually think that it would be better not to delete the sourcemaps. The true becomes more of a "force" now. As usually we recommend users to set disable-upload if they want to upload the sourcemaps themselves, but now we just delete the sourcemaps. Keeping the warning like before would still be better IMO

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a weird combo to test but With disable-upload and deleteSourcemapsAfterUpload not set or set to false, sourcemaps will be kept so we're not breaking exiting configs and deleteSourcemapsAfterUpload still does what users would expect.

I think ideally for v12 we should try and consolidate/improve all the options for sourcemaps because there are so many overlapping options and they are not that clear. I think we should have multiple clearer options here rather than controlling everything via the disable property. Maybe { upload: boolean, debugIds: boolean, deleteSourcemapsAfterUpload: boolean }? And they all default to true?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough.

Could you add a todo(v12) comment so we won't forget? Definitely makes sense to make it clearer here in v12

timfish and others added 3 commits November 13, 2026 11:32
…aps.disable` is set

Users set `sourcemaps.disable` to upload the maps themselves, so `deleteSourcemapsAfterUpload: true` now keeps those maps and warns, as before. Maps an SDK turned on (`sdkEnabledSourceMaps`) are still removed, as the SDK globs did.
Co-authored-by: Jan Peer Stöcklmair <jan.peer@sentry.io>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 258f438. Configure here.

expect(decision.log?.message).toMatch(/sourcemaps\.disable/);
}
},
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test loop should use it.each

Low Severity

This new test loops over hidden and visible inside one it.each. The testing conventions in the review rules file ask for a separate (it)|(test).each case per scenario instead of a loop inside a single test. Flagged because that file calls this out explicitly.

Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit 258f438. Configure here.

@JPeer264 JPeer264 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. One "todo comment" is still encouraged though (given in the comments) - follow up ticket works too for me.

@timfish
timfish enabled auto-merge (squash) November 13, 2026 13:44
@timfish
timfish merged commit 9279303 into develop Nov 13, 2026
449 of 453 checks passed
@timfish
timfish deleted the feat/bundler-plugins-delete-without-upload branch November 13, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants